﻿<%@ Page Title=" Quản lý câu hỏi" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="frmAdTaoCH.aspx.cs" Inherits="Admin_frmAdTaoCH" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="wrap">
        <h2>
            Quản lý câu hỏi
        </h2>
    </div>
    
    <table class="style1">
    <tr>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td class="style2">
            <asp:Label ID="Label2" runat="server" Text="Noi Dung"></asp:Label>
        </td>
        <td class="style2">
            <asp:UpdatePanel ID="UpdatePanel8" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="txtNoidungCH" runat="server" Enabled="False" Height="65px" 
                TextMode="MultiLine" Width="495px"></asp:TextBox>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td class="style2">
            <asp:Button ID="btnXoaCH" runat="server" onclick="btnXoaCH_Click" Text="Xoa CH" CssClass="button"
                    Width="85px" Height="27px" Visible="False" />
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label3" runat="server" Text="Muc Do"></asp:Label>
        </td>
        <td>
            <asp:UpdatePanel ID="UpdatePanel9" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="drplMucdo" runat="server" Enabled="False" 
    Width="126px">
                        <asp:ListItem>TB</asp:ListItem>
                        <asp:ListItem>Kho</asp:ListItem>
                        <asp:ListItem>De</asp:ListItem>
                    </asp:DropDownList>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td>
            <asp:Button ID="btnSua" runat="server" onclick="btnSua_Click" Text="Sua CH" CssClass="button"
                    Width="85px" Height="27px" Visible="False" />
        </td>
    </tr>
    <tr>
        <td class="style3">
            <asp:RadioButton ID="rdbA" runat="server" GroupName="cauhoi" Text="Câu A" />
        </td>
        <td class="style3">
            <asp:UpdatePanel ID="UpdatePanel6" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="txtA" runat="server" Enabled="False" 
                    ontextchanged="txtA_TextChanged" Height="34px" TextMode="MultiLine" 
                        Width="492px"></asp:TextBox>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td class="style3">
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            <asp:RadioButton ID="rdbB" runat="server" GroupName="cauhoi" Text="Câu B" />
        </td>
        <td>
                <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="txtB" runat="server" Enabled="False" 
                    ontextchanged="txtB_TextChanged" TextMode="MultiLine" Width="492px"></asp:TextBox>

                    </ContentTemplate>
                </asp:UpdatePanel>

        <td>
                &nbsp;</td>
    </tr>
    <tr>
        <td>
            <asp:RadioButton ID="rdbC" runat="server" GroupName="cauhoi" Text="Câu C" />
        </td>
        <td>
                <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="txtC" runat="server" Enabled="False" 
                    ontextchanged="txtC_TextChanged" TextMode="MultiLine" Width="491px"></asp:TextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
        </td>
        <td>
                &nbsp;</td>
    </tr>
    <tr>
        <td>
            <asp:RadioButton ID="rdbD" runat="server" GroupName="cauhoi" Text="Câu D" 
                />
        </td>
        <td>
                <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="txtD" runat="server" Enabled="False" 
                    ontextchanged="txtD_TextChanged" TextMode="MultiLine" Width="491px"></asp:TextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
        </td>
        <td>
                &nbsp;</td>
    </tr>
    <tr>
        <td>
            <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                <ContentTemplate>
                    <asp:Button ID="btnThemCH" runat="server" onclick="btnThemCH_Click" CssClass="button"
                    Text="Them CH" Width="85px" Height="27px" />
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td>
                &nbsp;</td>
        <td>
            <asp:Button ID="btnHuy" runat="server" CssClass="button" Height="27px" 
                onclick="btnHuy_Click" Text="Huy Thao Tac" Visible="False" Width="85px" />
        </td>
    </tr>
</table>
<br/>
    <div align="center" style="width:100%; border: solid 1px #CCCCCC;padding-top:7px; height:600px;  overflow:auto;">
        
        <asp:UpdatePanel ID="UpdatePanel10" runat="server">
            <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
    AutoGenerateColumns="False" CssClass="GridViewStyle" GridLines="None" 
            DataKeyNames="Idnganhangch" DataSourceID="SqlDataSource1" 
    Width="1071px">
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="MaCH" HeaderText="Mã Câu Hỏi" 
            SortExpression="MaCH" />
                        <asp:BoundField DataField="NoiDungCH" HeaderText="Nội Dung" 
            SortExpression="NoiDungCH">
                        <ItemStyle Width="350px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DA1" HeaderText="Phương Án 1" SortExpression="DA1">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DA2" HeaderText="Phương Án 2" SortExpression="DA2">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DA3" HeaderText="Phương Án 3" SortExpression="DA3">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DA4" HeaderText="Phương Án 4" SortExpression="DA4">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DADUNG" HeaderText="Đáp Án" SortExpression="DADUNG">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Mucdo" HeaderText="Mức Độ" SortExpression="Mucdo">
                        <ItemStyle Width="50px" />
                        </asp:BoundField>
                    </Columns>
                    <RowStyle CssClass="RowStyle" />
                    <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                    <PagerStyle CssClass="PagerStyle" />
                    <SelectedRowStyle CssClass="SelectedRowStyle" />
                    <HeaderStyle CssClass="HeaderStyle" />
                    <EditRowStyle CssClass="EditRowStyle" />
                    <AlternatingRowStyle CssClass="AltRowStyle" />
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
        
        <br />
        
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:TracNghiemTrucTuyenConnectionString %>" 
                SelectCommand="SELECT * FROM [tbl_NGANHANGCAUHOI]"></asp:SqlDataSource>
    </div>
    <script type="text/javascript">


        function ktRadioButton() {
            
            if (($("#<%=btnThemCH.ClientID %>").val() == "Luu CH"
                && !$("#<%=rdbA.ClientID %>").is(":checked")
                && !$("#<%=rdbB.ClientID %>").is(":checked")
                && !$("#<%=rdbC.ClientID %>").is(":checked")
                && !$("#<%=rdbD.ClientID %>").is(":checked"))
                )
            {
                alert("Bạn chưa chọn đáp án nào đúng!");
                return false;
            }
            if ($("#<%=btnThemCH.ClientID %>").val() == "Luu CH" 
                &&(($.trim($("#<%=txtA.ClientID %>").val()) == 0)
                || ($.trim($("#<%=txtB.ClientID %>").val()) == 0)
                || ($.trim($("#<%=txtC.ClientID %>").val()) == 0)
                || ($.trim($("#<%=txtD.ClientID %>").val()) == 0)))
            {
                alert("Thông báo! Có đáp án còn để trống!");
                return false;
                
            }
        }
    </script>
</asp:Content>

